﻿using Puerts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public delegate void MyCallBack1();
public delegate void MyCallBack2(string s);
public class JsEnvExample5 : MonoBehaviour
{
    public event MyCallBack1 onClick1;
    public event MyCallBack2 onClick2;
    private JsEnv jsEnv;
    // Start is called before the first frame update
    void Start()
    {
        jsEnv = new JsEnv(new DefaultLoader(UnityEngine.Application.dataPath + "/../TsProject/output"),8282);
        jsEnv.Eval("require('example5/ScriptExample5')");
    }
    public void ButtonClick()
    {
        onClick1();
        onClick2(Random.Range(1,100).ToString());
    }
    // Update is called once per frame
    void Update()
    {
        jsEnv.Tick();
    }
    private void OnDestroy()
    {
        jsEnv.Dispose();
    }
}
